package com.koron.order.change.bean.po;

import java.util.Comparator;

public enum OrderChangeStatus implements Comparator<OrderChangeStatus> {


    DRAFT("DRAFT", "草稿", 1),
    DONE("DONE", "已完成", 2),
    DEPRECATED("DEPRECATED", "已废弃", 10);

    private String status;
    private String desc;
    private int sort;

    OrderChangeStatus(String var1, String var2, int sort) {
        this.status = var1;
        this.desc = var2;
        this.sort = sort;
    }

    public String getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public int getSort() {
        return sort;
    }

    public static OrderChangeStatus getOrderChangeStatus(String status) {

        switch (status) {
            case "DRAFT":
                return DRAFT;
            case "DONE":
                return DONE;
            case "DEPRECATED":
                return DEPRECATED;
        }
        return null;
    }


    @Override
    public int compare(OrderChangeStatus o1, OrderChangeStatus o2) {
        return o1.getSort() - o2.getSort();
    }

}
